regression-simple-linear
Simple Linear Regression.
Installation
$ npm install --save ml-regression-simple-linear
Usage
import SimpleLinearRegression from 'ml-regression-simple-linear';
const x = [0.5, 1, 1.5, 2, 2.5];
const y = [0, 1, 2, 3, 4];
const regression = new SimpleLinearRegression(x, y);
regression.slope
regression.intercept
regression.coefficients
regression.predict(3);
regression.computeX(3.5);
regression.toString();
regression.score(x, y);
const json = regression.toJSON();
const loaded = SimpleLinearRegression.load(json);
loaded.predict(5)
License
MIT